<?php
/**
 * Created by PhpStorm.
 * User: s.utkin
 * Date: 14.08.14
 * Time: 12:33
 */

namespace Messenger\Messages\Send;

use Users\Profile;
use Messenger\BaseAction;

class AreaAction extends BaseAction
{
	public function privileges()
	{
		return '#messenger.canWriteMessages';
	}
    /**
     * Выводит область отправки сообщения
     */
    protected function run()
    {
        $myProfileId = $this->request->myProfileId;
        $companionProfileId = $this->request->companionProfileId;
		$companionProfile = Profile::find($companionProfileId);

        $this->response->profile = Profile::find($myProfileId);
        $this->response->companionProfileId = $companionProfileId;
        $this->response->companionProfileIsServiceType = $companionProfile->serviceType > 0;
        $this->response->groupId = (string)$this->request->groupId;
    }
}